package com.dao.impl;

import java.util.List;

import com.dao.MMsgClassDao;

public class MMsgClassDaoImpl extends UniversalDaoImpl implements MMsgClassDao {

	public List getListByParentCode(String code, int level) {
		String sql;

		level = 2 * level;
		if (code != null) {
			int len = code.length();
			sql = "select code,parent_code,name,leaf,enabled from m_msg_class  where left(code,"
					+ len
					+ ")='"
					+ code
					+ "' and length(code)<="
					+ level
					+ "  order by code";
		} else
			sql = "select code,parent_code,name,leaf,enabled from m_msg_class  where length(code)<="
					+ level + "  order by code";
		logger.info(sql);
		return getJdbcTemplate().queryForList(sql);
	}

}
